﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Sinacor.Servico.Bovespa.Titulo.Service.ServiceImplementation.Translator.BusinessEntityToDataContract
{
    public class Mercado
    {
        #region [PUB] ToMercadoResponse
        public DataContract.Response.MercadoResponse ToMercadoResponse(BusinessEntity.Mercado from)
        {
            DataContract.Response.MercadoResponse mercado;
            if (from == null)
                return null;
            else
            {
                mercado = new DataContract.Response.MercadoResponse();

                mercado.Codigo = from.Codigo;
                mercado.CodigoAlfa = from.CodigoAlfa;
                mercado.Descricao = from.Descricao;
              
            }
            return mercado;
        }
      
        public List<DataContract.Response.MercadoResponse> ToMercadoResponse(List<BusinessEntity.Mercado> from)
        {
            List<DataContract.Response.MercadoResponse> retorno = new List<DataContract.Response.MercadoResponse>();
            if (from == null)
                return null;
            else
            {
                DataContract.Response.MercadoResponse mercado;
                foreach (BusinessEntity.Mercado item in from)
                {
                    mercado = new DataContract.Response.MercadoResponse();

                    mercado.Codigo = item.Codigo;
                    mercado.CodigoAlfa = item.CodigoAlfa;
                    mercado.Descricao = item.Descricao;

                    retorno.Add(mercado);
                }

            }
            return retorno;
        }
        #endregion

    }
}
